﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StartGame : MonoBehaviour
{
    public static StartGame Instance { get; private set; }

    public SqlDbConnect _sqlDbConn;


    public Transform canvas;
    // Start is called before the first frame update
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
    }

    void Start()
    {
        GenerateLoadPanel();
    }

    private void GenerateLoadPanel()
    {
        var loadDataPanel = Instantiate(PrefabManager.Instance.LoadDataPanel,canvas);
        if (!loadDataPanel.GetComponent<LoadDataPanelView>())
            loadDataPanel.AddComponent<LoadDataPanelView>();
    }

    private void OnDisable()
    {
        if(_sqlDbConn != null)
          _sqlDbConn.Dispose();
        _sqlDbConn = null;
    }

    private void OnApplicationQuit()
    {
        _sqlDbConn = null;
        Debug.Log("结束运行");
    }
}
